<template>
  <div>
    <div class="mt20"></div>
    <div class="bor7 pa15">
      <div class="table-responsive mt20">
        <table class="table">
          <tbody>
            <tr>
              <th>申请时间</th>
              <th>申请人</th>
              <th>收款银行</th>
              <th>收款账户</th>
              <th>提现金额</th>
              <th>状态</th>
              <th>打款时间</th>
            </tr>
            <tr v-for="item in this.defaultList" :key="item.id">
              <td>{{ item.create_time | formatDate }}</td>
              <td>{{ item.name }}</td>
              <td>{{ item.bank }}</td>
              <td>{{ item.bank_number }}</td>
              <td>{{ item.out_money }}</td>
              <td v-if="item.progress == '申请中'" style="color: #409eff">
                {{ item.progress }}
              </td>
              <td v-else-if="item.progress == '成功'" style="color: #6ca12b">
                {{ item.progress }}
              </td>
              <td v-else="item.progress == '失败'" style="color: red">
                {{ item.progress }}
              </td>
              <td v-if="item.pay_time > 0">{{ item.pay_time | formatDate }}</td>
              <td v-else>-</td>
            </tr>
          </tbody>
        </table>
        <!-- 分页 -->
        <div class="block ta">
          <el-pagination
            layout="  prev, pager, next "
            :page-size="page_size"
            @current-change="current_change"
            :current-page.sync="currentPage"
            :pager-count="5"
            :total="defaultinfo.total"
            v-if="defaultinfo.pages > 1"
          >
          </el-pagination>
          <el-empty description="暂无数据" v-if="defaultinfo.pages == 0"></el-empty>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { formatDate } from "../../assets/data.js";
export default {
  // 时间戳
  filters: {
    formatDate(time) {
      time = time * 1000;
      let date = new Date(time);
      return formatDate(date, "yyyy-MM-dd hh:mm:ss");
    },
  },
  data() {
    return {
      defaultList: [],
      defaultinfo: [],
      sort: "id",
      page_size: 8, //每页多少数据
      currentPage: 1, //默认当前页为第一页
      ruleForm: {
        name: "",
        card: "",
      },
    };
  },
  methods: {
    getBankList() {
      var that = this;
      this.$axios
        .get(
          this.$api +
            "//api/moneyout/index?page_no=" +
            that.currentPage +
            "&page_size=" +
            that.page_size +
            "&sort=" +
            that.sort +
            "&order=desc&search=;type:;"
        )
        .then(function (response) {
          that.defaultList = response.data.data.data;
          that.defaultinfo = response.data.data.page;
          //console.log("defaultList", that.defaultList);
        })
        .catch(function (error) {
          //console.log(error);
        });
    },
    current_change(currentPage) {
      //改变当前页
      this.currentPage = currentPage;
      this.getBankList();
    },
  },
  mounted() {
    this.getBankList();
  },
};
</script>

<style scoped>
html {
  height: 100% !important;
  overflow-y: hidden !important;
}
.finance-box-fix {
  display: -webkit-flex;
  display: flex;
  width: 100%;
  background: #fff;
  text-align: center;
  padding: 1.875rem 1.25rem;
  border-radius: 0.4375rem;
}
.finance-box-fix > div {
  -webkit-flex: 1;
  flex: 1;
}
.finance-box-fix > div {
  border-right: 1px solid #f0f2f5;
}
.finance-box-fix > div:nth-last-child(1) {
  border-right: none;
}
.finance-box-fix > div:nth-of-type(1) {
  text-align: left;
}
.finance-box-fix > div .font36 {
  color: #4285f4;
}
.finance-box-fix > div .font14 {
  color: #484949;
}
.finance-box-fix > div .font12 {
  color: #9fa0a3;
}
.finance-box-fix > div .el-button--primary {
  margin-left: 5.625rem;
  padding: 7px 20px;
}
.finance-feg {
  padding: 1.25rem;
  line-height: 24px;
  color: #545556;
}
.finance-feg span {
  color: #de5044;
}
.table th {
  border-top: none;
  background: #f6f5f5;
  font-size: 0.875rem;
  color: #545556;
  line-height: 3.4375rem !important;
  text-align: center;
  font-size: 0.875rem;
}
table tr td {
  line-height: 3.4375rem !important;
  text-align: center;
  font-size: 0.875rem;
  border-top: none;
  border-bottom: 1px solid #f6f5f5;
}
table .el-button {
  padding: 0.3125rem 0.625rem;
  font-size: 0.875rem;
}
.el-button--danger {
  background: #de5044;
  border-color: #de5044;
}
.el-button--success {
  background: #19a15f;
}
.el-form-item {
  margin-bottom: 0.625rem;
}
</style>
